﻿<local:OwnedWindow x:Class="TerraMap.WorldPropertiesWindow"
									 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
									 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
									 xmlns:ComponentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
									 xmlns:local="clr-namespace:TerraMap"
									 Title="TerraMap - World Properties" Height="480" Width="340" Icon="Resources/App.ico"
									 Loaded="OnLoaded">
  <Window.Resources>
    <CollectionViewSource x:Key="collectionViewSource" Source="{Binding Properties}" Filter="OnFilter">
      <CollectionViewSource.SortDescriptions>
        <ComponentModel:SortDescription Direction="Ascending" PropertyName="Name"/>
      </CollectionViewSource.SortDescriptions>
    </CollectionViewSource>
    <Style TargetType="Button">
      <Setter Property="Margin" Value="2" />
      <Setter Property="Padding" Value="2" />
    </Style>
  </Window.Resources>
  <Window.CommandBindings>
    <CommandBinding Command="Close" CanExecute="OnCanExecuteClose" Executed="OnExecutedClose" />
  </Window.CommandBindings>
  <Window.InputBindings>
    <KeyBinding Key="Esc" Command="Close" />
  </Window.InputBindings>
  <DockPanel LastChildFill="True">
    <Grid DockPanel.Dock="Top">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="Auto" />
      </Grid.ColumnDefinitions>
      <TextBlock Grid.Column="0" Margin="2">Name:</TextBlock>
      <TextBox Grid.Column="1" x:Name="searchBox" Margin="2" TextChanged="OnSearchTextChanged" />
      <Button Grid.Column="2" Click="OnSearchBoxClear" ToolTip="Clear">
        <local:AutoGreyableImage Source="Resources/Cancel.png" Width="16" />
      </Button>
    </Grid>
    <ListView ItemsSource="{Binding Source={StaticResource collectionViewSource}}">
      <ListView.View>
        <GridView>
          <GridView.Columns>
            <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" Width="Auto" />
            <GridViewColumn Header="Value" DisplayMemberBinding="{Binding Value}" Width="Auto" />
          </GridView.Columns>
        </GridView>
      </ListView.View>
    </ListView>
  </DockPanel>
</local:OwnedWindow>
